/* eslint-disable */
import _m0 from "protobufjs/minimal";

export const protobufPackage = "slash.api.v1";

export interface ExportJsonRequest {
  persisted: boolean;
  collectionIds: number[];
}

export interface ExportJsonResponse {
  filepath: string;
}

export interface ImportJsonRequest {
  fileContent: Uint8Array;
}

export interface ImportJsonResponse {
}

function createBaseExportJsonRequest(): ExportJsonRequest {
  return { persisted: false, collectionIds: [] };
}

export const ExportJsonRequest = {
  encode(message: ExportJsonRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.persisted === true) {
      writer.uint32(8).bool(message.persisted);
    }
    writer.uint32(18).fork();
    for (const v of message.collectionIds) {
      writer.int32(v);
    }
    writer.ldelim();
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ExportJsonRequest {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseExportJsonRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 8) {
            break;
          }

          message.persisted = reader.bool();
          continue;
        case 2:
          if (tag === 16) {
            message.collectionIds.push(reader.int32());

            continue;
          }

          if (tag === 18) {
            const end2 = reader.uint32() + reader.pos;
            while (reader.pos < end2) {
              message.collectionIds.push(reader.int32());
            }

            continue;
          }

          break;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ExportJsonRequest>): ExportJsonRequest {
    return ExportJsonRequest.fromPartial(base ?? {});
  },

  fromPartial(object: DeepPartial<ExportJsonRequest>): ExportJsonRequest {
    const message = createBaseExportJsonRequest();
    message.persisted = object.persisted ?? false;
    message.collectionIds = object.collectionIds?.map((e) => e) || [];
    return message;
  },
};

function createBaseExportJsonResponse(): ExportJsonResponse {
  return { filepath: "" };
}

export const ExportJsonResponse = {
  encode(message: ExportJsonResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.filepath !== "") {
      writer.uint32(10).string(message.filepath);
    }
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ExportJsonResponse {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseExportJsonResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 10) {
            break;
          }

          message.filepath = reader.string();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ExportJsonResponse>): ExportJsonResponse {
    return ExportJsonResponse.fromPartial(base ?? {});
  },

  fromPartial(object: DeepPartial<ExportJsonResponse>): ExportJsonResponse {
    const message = createBaseExportJsonResponse();
    message.filepath = object.filepath ?? "";
    return message;
  },
};

function createBaseImportJsonRequest(): ImportJsonRequest {
  return { fileContent: new Uint8Array(0) };
}

export const ImportJsonRequest = {
  encode(message: ImportJsonRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.fileContent.length !== 0) {
      writer.uint32(10).bytes(message.fileContent);
    }
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ImportJsonRequest {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseImportJsonRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 10) {
            break;
          }

          message.fileContent = reader.bytes();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ImportJsonRequest>): ImportJsonRequest {
    return ImportJsonRequest.fromPartial(base ?? {});
  },

  fromPartial(object: DeepPartial<ImportJsonRequest>): ImportJsonRequest {
    const message = createBaseImportJsonRequest();
    message.fileContent = object.fileContent ?? new Uint8Array(0);
    return message;
  },
};

function createBaseImportJsonResponse(): ImportJsonResponse {
  return {};
}

export const ImportJsonResponse = {
  encode(_: ImportJsonResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    return writer;
  },

  decode(input: _m0.Reader | Uint8Array, length?: number): ImportJsonResponse {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseImportJsonResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },

  create(base?: DeepPartial<ImportJsonResponse>): ImportJsonResponse {
    return ImportJsonResponse.fromPartial(base ?? {});
  },

  fromPartial(_: DeepPartial<ImportJsonResponse>): ImportJsonResponse {
    const message = createBaseImportJsonResponse();
    return message;
  },
};

export type BackupServiceDefinition = typeof BackupServiceDefinition;
export const BackupServiceDefinition = {
  name: "BackupService",
  fullName: "slash.api.v1.BackupService",
  methods: {
    exportJson: {
      name: "ExportJson",
      requestType: ExportJsonRequest,
      requestStream: false,
      responseType: ExportJsonResponse,
      responseStream: false,
      options: {
        _unknownFields: {
          578365826: [
            new Uint8Array([
              28,
              18,
              26,
              47,
              97,
              112,
              105,
              47,
              118,
              49,
              47,
              98,
              97,
              99,
              107,
              117,
              112,
              47,
              101,
              120,
              112,
              111,
              114,
              116,
              47,
              106,
              115,
              111,
              110,
            ]),
          ],
        },
      },
    },
    importJson: {
      name: "ImportJson",
      requestType: ImportJsonRequest,
      requestStream: false,
      responseType: ImportJsonResponse,
      responseStream: false,
      options: {
        _unknownFields: {
          578365826: [
            new Uint8Array([
              31,
              58,
              1,
              42,
              34,
              26,
              47,
              97,
              112,
              105,
              47,
              118,
              49,
              47,
              98,
              97,
              99,
              107,
              117,
              112,
              47,
              105,
              109,
              112,
              111,
              114,
              116,
              47,
              106,
              115,
              111,
              110,
            ]),
          ],
        },
      },
    },
  },
} as const;

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin ? T
  : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;
